<template>
    <div>
       <div>
            <select v-model="query.type">
                <option value="">请选择类型</option>
                <option value="name">姓名</option>
                <option value="gender">性别</option>
                <option value="phone">电话</option>
            </select>
            <input type="text" v-model="query.value">
            <button @click="getDirectors">搜索</button>
       </div>
       <table>
            <thead>
                <tr>
                    <td>编号</td>
                    <td>姓名</td>
                    <td>性别</td>
                    <td>电话</td>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in list" :key="item._id">
                    <td>{{item._id}}</td>
                    <td>{{item.name}}</td>
                    <td>{{item.gender}}</td>
                    <td>{{item.phone}}</td>
                </tr>
            </tbody>
       </table>
    </div>
</template>

<script>
export default {
    data(){
        return{
            list:[],
            query:{
                type:'',
                value:''
            }
        }
    },
    methods:{
        async getDirectors(){
            console.log('**************');
            const result=await this.$api.directors.getDirectors(this.query)
            console.log(result);
            this.list=result.data.result
        }
    },
    created(){
        this.getDirectors()
    }
}
</script>

<style>

</style>